{% extends "base.html" %}

{% block head %}
  <script type="text/javascript">
  //<![CDATA[

  function checkForm(theForm) {
    var domainName = theForm.domainName;
    
    if(domainName.value.length <= 0) {
      alert("请输入要备份的域名啊！");
      domainName.focus();
      return false;
    }
    var submitButton = theForm.submitButton;
    submitButton.disabled = true;
    submitButton.value = '  正在备份中...  '
    return true;
  }
  </script>
{% endblock %}

{% block body %}
    
    <form action="/backup" method="post" onSubmit="return checkForm(this)">
      <div align="center">
      输入要备份的URL：
      http://<input type="text" name="domainName" size="10" value="zjjzyfood">.en.alibaba.com
      <input type="submit" name="submitButton" value="   备份   ">
      <div>最近20个备份历史记录：</div>
      </div>
      {% if historys %}
          <table width="100%" border="1">
              <tr>
                  <td align="center">站点</td>
                  <td align="center">备份时间</td>
                  <td align="center">文件数</td>
                  <td align="center">文件容量</td>
                  <td align="center">图片数</td>
                  <td align="center">图片容量</td>
              </tr>
            {% for history in historys %}
              <tr>
                  <td><a href="/history?key={{history.key}}">{{history.site}}</a></td>
                  <td align="center">{{history.gmtCreate|date:"Y-m-d H:i:s"}}</td>
                  <td align="center">{{history.pageCount}}</td>
                  <td align="right">{{ history.pageSize|filesizeformat }}</td>
                  <td align="center">{{history.imageCount}}</td>
                  <td align="right">{{ history.imageSize|filesizeformat }}</td>
              </tr>
            {% endfor %}
          </table>
      {% endif %}
    </form>
    
{% endblock %}
